
var a1=document.querySelectorAll("#xx");
var div=document.querySelectorAll(".one");

var i=0;
for (i=0;i<a1.length;i++){
    a1[i].index=i;
    a1[i].onmousemove=function () {
        for (i=0;i<a1.length;i++){
            a1[i].className="";
            div[i].style.display="none";
        }
        div[this.index].style.display="block";
        this.className="xxk";
    }
}



new Vue({
    el:'#tp',
    data:{
        message: 'wodiu',
        oaa:[
            {ta:"小米红外遥控器",tb:"39元",tc:"1147人好评",images:"images/tl-1.jpg"},
            {ta:"ZMI 苹果编制数据线(0.3m)",tb:"49元",tc:"227人好评",images:"images/tl-2.jpg"},
            {ta:"小米路由器",tb:"999元",tc:"376人好评",images:"images/tl-3.jpg"},
            {ta:"RedmiBook 14 i7 8G 512GB",tb:"4999元",tc:"22人好评",images:"images/tl-4.jpg"},
            {ta:"米家互联网空调(一级能效)",tb:"2199元",tc:"",images:"images/tl-5.jpg"},
            {ta:"米家互联网空调C1 (一级能...",tb:"2399元",images:"images/tl-6.jpg"},
            {ta:"米家空调",tb:"1599元",images:"images/tl-7.jpg"},
            {ta:"小米小爱音响 米家遥控版",tb:"199元",tc:"379人好评",images:"images/tl-8.jpg"},
            {ta:"米家互联网空调",tb:"1999元",images:"images/tl-9.jpg"},
            {ta:"小米盒子4 SE套装版",tb:"189元",images:"images/tl-10.jpg"},
            {ta:"米家互联网空调C1",tb:"2199元",images:"images/tl-11.jpg"},
            {ta:"小白智能摄影机 电池版",tb:"399元",tc:"21人好评",images:"images/tl-12.jpg"},
            {ta:"小米笔记本 Air 13.3' 2019款...",tb:"6299元",images:"images/tl-13.png"},
            {ta:"黑鲨双翼手柄单滑轨保护壳...",tb:"228元",images:"images/tl-14.jpg"},
            {ta:"米连卡随身路由器套装",tb:"599元",images:"images/tl-15.jpg"},
            {ta:"最生活毛巾·Air(100条装)",tb:"1690元",tc:"66人好评",images:"images/tl-16.png"},
            {ta:"黑鲨双翼手柄-左柄套装",tb:"188.9元",images:"images/tl-17.jpg"},
            {ta:"净水器滤芯全年套装",tb:"234元",images:"images/tl-18.jpg"},
            {ta:"小米电视4 55英寸影院版",tb:"3698元",images:"images/tl-19.jpg"},
            {ta:"净水器滤芯 两年套装",tb:"198元",images:"images/tl-20.jpg"}
        ]
    }
})


var swiper = new Swiper('.co-one', {
    slidesPerView: 5,
    spaceBetween: 10,
    loop: true,
    navigation: {
        nextEl: '.next-one',
        prevEl: '.prev-one'
    }
});



var swiper = new Swiper('.co-two', {
    slidesPerView: 1,
    spaceBetween: 30,
    slidesPerGroup: 1,
    loop: true,
    loopFillGroupWithBlank: true,
    pagination: {
        el: '.pag-two',
        clickable: true,
    },
    navigation: {
        nextEl: '.next-two',
        prevEl: '.prev-two',
    },
});

var swiper = new Swiper('.co-three', {
    slidesPerView: 1,
    spaceBetween: 30,
    slidesPerGroup: 1,
    loop: true,
    loopFillGroupWithBlank: true,
    pagination: {
        el: '.pag-three',
        clickable: true,
    },
    navigation: {
        nextEl: '.next-three',
        prevEl: '.prev-three',
    },
});

var swiper = new Swiper('.co-four', {
    slidesPerView: 1,
    spaceBetween: 30,
    slidesPerGroup: 1,
    loop: true,
    loopFillGroupWithBlank: true,
    pagination: {
        el: '.pag-four',
        clickable: true,
    },
    navigation: {
        nextEl: '.next-four',
        prevEl: '.prev-four',
    },
});

var swiper = new Swiper('.co-five', {
    slidesPerView: 1,
    spaceBetween: 30,
    slidesPerGroup: 1,
    loop: true,
    loopFillGroupWithBlank: true,
    pagination: {
        el: '.pag-five',
        clickable: true,
    },
    navigation: {
        nextEl: '.next-five',
        prevEl: '.prev-five',
    },
});

var t=document.querySelector("#toTop");

window.onscroll = function () {
    console.log(document.documentElement.scrollTop >1000 || document.body.scrollTop >1000);

    if (document.documentElement.scrollTop >1000 || document.body.scrollTop >1000){
        t.style.display = "block";
    }else {
        t.style.display = "none";
    }
};

//点击返回顶部
t.addEventListener('click',function () {
    //让 scrollto 支持平滑滚动
    window.scrollTo({
        top:0,
        behavior:'smooth'
    })
});

var bf=document.querySelectorAll(".vi-1 > span");
var img=document.querySelectorAll(".vi-1 > img");
var vid=document.querySelectorAll(".kuang");
var tad=document.querySelectorAll(".shi > .t");
var da=document.querySelector(".da");
var dian=document.querySelectorAll(".t p span");

for (var i=0;i<bf.length;i++){
    bf[i].index=i;
    bf[i].onclick=function () {
        vid[this.index].style.display="block";
        bf[this.index].style.display="none";
        da.style.zIndex="99";
    }
    dian[i].index=i;
    dian[i].onclick=function () {
        bf[this.index].style.display="block";
        vid[this.index].style.display="none";
    }
}

for (var i=0;i<bf.length;i++){
    vid[i].index=i;
    vid[i].onclick=function () {
       
    }


    var qd=document.querySelector(".chudiao")
    qd.onclick=function () {
        qd.style.display="none";
    }
}


var xjt=document.querySelector(".na i");
var top1=document.querySelector(".nx");
var bot1=document.querySelector(".ny");
var nna1=document.querySelector("nav");

xjt.onclick=function () {
    if(top1.style.display=="none"){
        top1.style.display="block";
        bot1.style.display="none";
        xjt.style="transform:rotate(0deg);transition-duration:0.3s";
    }else{
    top1.style.display="none";
    bot1.style.display="block";
    xjt.style="transform:rotate(180deg);transition-duration:0.3s";
    nna1.style="height:100%";
    }
}

var swiper1 = new Swiper('.app-ll', {
    pagination: {
        el: '.swiper-pagination',
    },
});


var app=document.querySelectorAll(".ap-footer > div");
var main=document.querySelectorAll(".ma > div");
for (var i=0;i<app.length;i++){
    app[i].index=[i];
    app[i].addEventListener('click', function() {
        for(var k = 0; k < app.length; k++) {
            app[k].classList.remove('active');
            main[k].classList.remove('active');
        }
        this.classList.add('active');
        console.log(this.index);
        main[this.index].classList.add('active');
    })
}












